#!/bin/bash
source ${HOME}/lgimRobot/bin/common "$@"

main() {
    # 激光定位
    [ "$(get_ros2_param "AGVParam.laser_support.value")" = "true" ] && {
        launch_node "pubulish_map" ros2 run slam_ros publish_occupancy_grid_map
        launch_node "edit_map" ros2 run slam_ros edit_map
        launch_node "slam_ros" ros2 run slam_ros slam_ros_node
    }

    # 融合定位
    [ "$(get_ros2_param "AGVParam.fusion_support.value")" = "true" ] && \
        launch_node "融合定位" ros2 run fusion_location fusion_location_node
    
    # 二维码定位
    [ "$(get_ros2_param "AGVParam.qrCode_support.value")" = "true" ] && \
        launch_node "qr_odom" ros2 run qrodom qrodom
    
    # 磁导航定位
    [ "$(get_ros2_param "AGVParam.magnetic_support.value")" = "true" ] && {
        launch_node "磁传感器" ros2 run mag_sensor_driver mag_sensor_node
        launch_node "磁导航" ros2 run magnet_ros magnet_ros_node
    }
    
    # 反光板定位
    [ "$(get_ros2_param "AGVParam.reflector_support.value")" = "true" ] && \
        launch_node "反光板定位" ros2 run reflector_slam_ros reflector_slam_ros_node
    
    # 3D SLAM定位
    [ "$(get_ros2_param "AGVParam.multi_slam_support.value")" = "true" ] && \
        launch_node "3D SLAM" ros2 run faster_lio localization_mid360_node
    
    return 0
}

main